Skip to content

[Java] Replace maven-release-plugin with CI-friendly versions - #2603

Merged
roji merged 7 commits into
mainfrom
sandraahlgrimm-java-drop-maven-release-plugin
Sep 15, 2026
Merged

roji merged 7 commits into
mainfrom
sandraahlgrimm-java-drop-maven-release-plugin

Conversation

@SandraAhlgrimm

@SandraAhlgrimm SandraAhlgrimm commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #2579

Summary

Make Java publication a read-only consumer of an immutable source commit. Remove release-plugin commits, direct pushes to main, privileged repository tokens, and rollback machinery while retaining Maven Central publication and independent Java retries.

Changes

CI-friendly Maven versions

  • Define the development default once as <revision>1.0.14-SNAPSHOT</revision> and use ${revision} throughout the POM hierarchy.
  • Remove maven-release-plugin; inject the shared release version with -Drevision=<version>.
  • Retain flattening so installed/published POMs contain literal coordinates without the unpublished parent.

Trusted, immutable release sources

  • Require Java publication to run from main.
  • Bootstrap validation from the trusted triggering commit, with full Git history. Before checking out or executing a requested source, require a full commit SHA reachable from main.
  • Pass only the validated source to all classifier builds and the primary SDK build. Historical commits on main remain valid for independent retries with the original version and SHA.
  • Disable shared Maven and automatic npm caches in this SHA-selectable release workflow; remove the unnecessary cache-enabled CLI setup step.
  • Keep repository permissions read-only and retain only Maven Central/GPG publication credentials in the Maven publisher. Snapshot publication remains read-only.

Post-publication tags and documentation

  • Create java/vX.Y.Z in the shared github-release job after package publication succeeds. Existing lightweight or annotated tags must resolve to the original release SHA; mismatches fail without overwriting tags.
  • Dispatch the standalone documentation site from a separate downstream job so a dispatch retry does not recreate releases or republish packages.
  • Document the versioning model, trusted-source retry contract, and a non-publishing mvn clean verify -Drevision=1.2.3 example. Documentation version updates remain reviewed PR changes.

Regression coverage

  • Use one synthetic non-SNAPSHOT revision (0.0.0-ci) across all native input jobs and the publication assembly.
  • Use install, not deploy, for both local artifact builds. Remove the ineffective skipPublishing profile instead of relying on it to prevent Central access.
  • Check both installed POMs for literal coordinates, no unresolved ${revision}, and no parent reference; preserve classifier, sources, Javadoc, and signature assertions.
  • Add source-trust tests covering current/historical main commits, unmerged commits, non-main dispatches, malformed/abbreviated SHAs, tag/tree objects, missing history, and CLI failure behavior.

Verification

  • Existing publication regression coverage and the new source-trust tests run in Java CI.
  • The signed native/SDK publication assembly and Java required gate passed after switching local builds to install.
  • Local source-trust tests cover historical retries and reject untrusted sources before any checkout target is emitted.
  • No real Maven Central publication or release workflow was triggered during validation. The PR checks report the latest CI and CodeQL results.

cc @edburns for review.

Copilot AI balanced review requested due to automatic review settings September 10, 2026 09:18
@SandraAhlgrimm
SandraAhlgrimm requested a review from a team as a code owner September 10, 2026 09:18
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Release retryability, tag validation, unsafe documentation, and automated coverage need correction.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 2 Medium severity · 1 Low severity

New issues introduced by this change (4)
Severity Finding
High severity .github/​workflows/​publish.yml — The new Java tag silently accepts any pre-existing java/vX.Y.Z tag without checking its target.…
Medium severity .github/​workflows/​publish.yml — A transient failure while dispatching the site workflow is not retryable: this step now runs at the…
Medium severity java/​pom.xml — The release-only ${revision} override and flattening path is not exercised by the existing…
Low severity java/​README.md — This local-validation command runs deploy with the Central publishing extension configured with…
What changed in this PR

Reworks Java releases to use Maven CI-friendly ${revision} versions and immutable source commits without mutating main.

Changes:

  • Replaces Maven release-plugin versioning with ${revision}.
  • Makes Maven publication read-only and source-SHA pinned.
  • Moves Java tagging and site deployment into the shared release workflow.
File Description
java/​pom.xml Defines the shared revision and removes the release plugin.
java/​sdk/​pom.xml Inherits the CI-friendly parent version.
java/​copilot-native/​pom.xml Inherits the CI-friendly parent version.
java/​README.md Documents the new release model.
.github/​workflows/​java-publish-maven.yml Publishes from an immutable SHA without repository writes.
.github/​workflows/​publish.yml Passes the source SHA and handles Java tagging/site deployment.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/publish.yml Outdated
Comment thread .github/workflows/publish.yml Outdated
Comment thread java/pom.xml Outdated
Comment thread java/README.md Outdated
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Java tag failures cannot be retried after the non-idempotent GitHub Release creation succeeds.

Review tier: Balanced
Findings: None

Issues resolved since last review (4)
Severity Finding
Low severity java/​README.md — This local-validation command runs deploy with the Central publishing extension configured with… View resolved comment
Medium severity java/​pom.xml — The release-only ${revision} override and flattening path is not exercised by the existing… View resolved comment
Medium severity .github/​workflows/​publish.yml — A transient failure while dispatching the site workflow is not retryable: this step now runs at the… View resolved comment
High severity .github/​workflows/​publish.yml — The new Java tag silently accepts any pre-existing java/vX.Y.Z tag without checking its target.… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

.github/workflows/publish.yml:511

  • This tag operation is still placed after the non-idempotent gh release create steps. If the tag fetch or push fails transiently after the release has been created, rerunning the failed github-release job fails immediately because that release already exists, so the Java tag is never retried. Move Java tagging to its own downstream job (as done for the site dispatch), or make release creation safely idempotent before adding a later fallible step.

@github-actions

This comment has been minimized.

@edburns

edburns commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

My understanding is that #2579 is a blocker to your plan to incorporate copilot-sdk into copilot-agent-runtime.

Therefore, because I was busy on another task for my management, I sought and received help from fellow Berliner @SandraAhlgrimm . She has promptly delivered PR 2603 to fix this issue.

I seek your review, in addition to the review I will provide.

After this is merged, I intend to cut a preview release to test it out.

But first, please take a close look.

Thanks,

Ed

@roji roji left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two remaining release-workflow issues: the publication test-skipping behavior with current main, and retryability of Java tagging after GitHub release creation.

Comment thread .github/workflows/java-sdk-tests.yml Outdated
Comment thread .github/workflows/publish.yml

@roji roji left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too - thanks @SandraAhlgrimm! - but @edburns is the Java authority here in any case.

@SandraAhlgrimm see my two comments above, one of these seems to explain why this PR is failing CI.

@roji
roji enabled auto-merge September 11, 2026 15:00
SandraAhlgrimm and others added 6 commits September 14, 2026 22:18
Make the Java release pipeline a read-only consumer of the commit being
released, consistent with the other SDKs. A Java release now creates no
commits on `main`, requires no elevated repository token or ruleset
bypass, and publishes artifacts whose version and source SHA match the
other SDK artifacts in the same release.

- POMs: adopt ${revision} CI-friendly versions (single <revision>
  property in java/pom.xml); remove maven-release-plugin.
- java-publish-maven.yml: drop preflight/prepare-release/rollback-release;
  add resolve-source; build all classifiers + deploy from one immutable
  SHA with -Drevision; contents: read only; no JAVA_RELEASE_TOKEN.
- publish.yml: publish-java contents: read + sourceSha; create the
  java/vX.Y.Z traceability tag and trigger the site deploy in
  github-release after publication succeeds.
- java/README.md: document the new versioning/release model.

Fixes #2579

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Guard existing Java tags against source mismatches and separate site dispatch into an independently retryable job. Exercise a synthetic release revision across classifier builds and both locally installed Java artifacts, validate flattened POM coordinates, and replace the README deployment example with a non-publishing build.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use Maven install for CI's local release assembly instead of invoking Central's deploy goal, and remove the ineffective skipPublishing profile. Disable dependency caching in the SHA-selectable release workflow, including automatic npm caching and the unnecessary cached CLI setup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bootstrap source validation from the trusted triggering commit and require main-branch publication. Accept only full commit SHAs reachable from main before checking out or executing the requested source. Pass only the validated source to every release build, preserve historical retries, and add source-trust regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove the obsolete repository push token and associate the documentation deployment token with the shared publish workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: da1e04ac-3079-4aa4-b495-4358cb3c6b04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3677753e-fc35-436e-934b-33aa3d07c4e0
@edburns
edburns force-pushed the sandraahlgrimm-java-drop-maven-release-plugin branch from f91c7eb to 71aa04c Compare September 14, 2026 22:19
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3677753e-fc35-436e-934b-33aa3d07c4e0
@github-actions

Copy link
Copy Markdown
Contributor

SDK Consistency Review — PR #2603

Scope of changes: This PR only touches Java release/build infrastructure and documentation — no SDK client API code is modified:

  • .github/workflows/java-publish-maven.yml, java-publish-snapshot.yml, java-sdk-tests.yml, java-smoke-test.yml, publish.yml, required-checks.yml
  • docs/developer-docs/secrets.md
  • java/README.md
  • java/copilot-native/pom.xml, java/copilot-native/scripts/validate-local-publication.mjs, java/copilot-native/scripts/validate-native-artifact.test.mjs
  • java/pom.xml, java/sdk/pom.xml
  • java/scripts/resolve-release-source.mjs (new) and its test

None of these files are under java/sdk/src/main/java/, nodejs/src/, python/copilot/, go/, dotnet/src/, or rust/src/, so there is no public SDK method, parameter, or return-type change to compare across languages. The changes concern how the Java artifact is released (source SHA selection, native-classifier publishing, and dispatch inputs), which is inherently Java/Maven-specific tooling and does not need a parallel implementation in the other language SDKs.

Conclusion: No cross-language API or feature-parity concerns were found. This PR is out of scope for the SDK consistency check.

Generated by SDK Consistency Review Agent for #2603 · copilot · sonnet50 · 21.6 AIC · ⌖ 12.2 AIC · ⊞ 8.3K ·

@roji
roji added this pull request to the merge queue Sep 15, 2026
Merged via the queue into main with commit 22e8607 Sep 15, 2026
353 of 361 checks passed
@roji
roji deleted the sandraahlgrimm-java-drop-maven-release-plugin branch September 15, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] Cease using maven-release-plugin due to its opinionated mutations of git history

4 participants